<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        function getNewArr() {
            //方法一：
            //将所有的arr替换为arguments
            var NewArr = [];
            for (var i = arguments.length - 1; i >= 0; i--) {
                NewArr[NewArr.length] = arguments[i];
            }
            return NewArr;
        }
        console.log(getNewArr(1, 6, 9, 10, 35));
        console.log(getNewArr(33, 67, 89, 90, 65));
        //方法二：
        //不使用arguments
        function reverse(arr) { //reverse为翻转的意思
            var newArr = [];
            for (var i = arr.length - 1; i >= 0; i--) {
                newArr[newArr.length] = arr[i];
            }
            return newArr;
        }
        var arr1 = reverse([1, 7, 9, 89, 90]);
        console.log(arr1);
        var arr2 = reverse([6, 5, 4, 3, 2, 1, 0, 99]);
        console.log(arr2);
    </script>
</head>

<body>

</body>

</html>